package com.object.module.cbb.frontEnd;

import com.object.configuration.utils.Q;
import com.object.module.cbb.entity.CddShopEntity;
import com.object.module.cbb.service.CbbShoppingCartService;
import com.object.module.cbb.service.CddSpikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 秒杀商品
 */
@RestController
@RequestMapping("/frontend/spike")
public class FronEndSpikeController {
    @Autowired
    private CddSpikeService cddSpikeService;
    @Autowired
    private CbbShoppingCartService cbbShoppingCartService;

    @GetMapping("/list")
    public Q listSpike() {
        Q q = cddSpikeService.list();
        return q;
    }


    /**
     * 商品秒杀
     */
    @GetMapping("/{spId}/{urId}")
    public Q spike(@PathVariable("spId") Long spId, @PathVariable("urId") Integer urId) {
        Q q = cbbShoppingCartService.spike(spId, urId);
        return q;
    }

}
